﻿<!--
<copyright company="Christoph van der Fecht - VDsoft">
Copyright (C) Christoph van der Fecht - VDsoft - All Rights Reserved
Unauthorized copying of this file, via any medium is strictly prohibited,
unless it is communicated and authorized by the copyright owner.
</copyright>
-->
<UserControl x:Class="SeriesManager.Controls.BannerManagerControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             Height="380" 
			 Width="525"
			 MinHeight="380"
			 MinWidth="525"
			 DataContext="{Binding Path=BannerManagerView, Source={StaticResource Locator}}">
    <Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="3*"/>
			<RowDefinition Height="18*"/>
			<RowDefinition Height="1.3*"/>
		</Grid.RowDefinitions>
		<!-- select season -->
		<StackPanel Orientation="Vertical"
					HorizontalAlignment="Center"
					Grid.Row="0" >
			<TextBlock Text="Series or season Folder"
					   FontSize="14"
					   Margin="2,2,2,1"/>
			<StackPanel Orientation="Horizontal">
				<TextBox Text="{Binding Path=SeriesPath, Mode=TwoWay}"
						 Margin="2"
						 FontSize="15"
						 Width="400"/>
				<Button Content="Browse..."
						Margin="5"
						Command="{Binding Path=BrowseSeasonCommand}"/>
			</StackPanel>
		</StackPanel>
		<TabControl Grid.Row="1"
					Margin="0,2,0,0"
					VerticalAlignment="Stretch"
					HorizontalAlignment="Stretch"
					SelectedItem="{Binding Path=SelectedTab, Mode=TwoWay}">
			<!--Fanarts-->
			<TabItem Header="Fanarts">
				<ListView ItemsSource="{Binding Path=FanArts}"
						  Margin="2"
						  VerticalAlignment="Stretch"
						  HorizontalAlignment="Stretch"
						  SelectedItem="{Binding Path=CurrentBanner, Mode=TwoWay}">
					<ListView.ItemTemplate>
						<DataTemplate>
							<Image Source="{Binding Path=ThumbnailPath, Mode=OneWay}"
						   Width="180"
						   Stretch="Uniform"/>
						</DataTemplate>
					</ListView.ItemTemplate>
					<ListView.ItemsPanel>
						<ItemsPanelTemplate>
							<WrapPanel IsItemsHost="True"
							   Width="{Binding (FrameworkElement.ActualWidth), RelativeSource={RelativeSource AncestorType=ScrollContentPresenter}}"/>
						</ItemsPanelTemplate>
					</ListView.ItemsPanel>
				</ListView>
			</TabItem>
			<!--Season poster-->
			<TabItem Header="Season Poster">
				<Grid DataContext="{Binding Path=SeasonGraphics}">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="4*"/>
						<ColumnDefinition Width="16*"/>
					</Grid.ColumnDefinitions>
					<!--Seasons-->
					<ListView x:Name="SeasonListView"
							  Grid.Column="0"
							  ItemsSource="{Binding Path=Seasons}"
							  SelectedValue="{Binding Source={StaticResource ResourceKey=Locator}, Path=BannerManagerView.SelectedSeason, Mode=TwoWay}"
							  Margin="2"
							  VerticalAlignment="Stretch"
							  HorizontalAlignment="Stretch"
							  SelectedIndex="0">
						<ListView.ItemTemplate>
							<DataTemplate>
								<TextBlock Text="{Binding Path=Season, Mode=OneWay, StringFormat=Season {0}}"
										   Margin="2"/>
							</DataTemplate>
						</ListView.ItemTemplate>
					</ListView>
					<!--Graphics-->
					<ListView Grid.Column="1"
							  ItemsSource="{Binding SelectedItem.Banners, ElementName=SeasonListView}"
							  Margin="2"
							  VerticalAlignment="Stretch"
							  HorizontalAlignment="Stretch"
							  SelectedItem="{Binding Path=BannerManagerView.CurrentBanner, Mode=TwoWay, Source={StaticResource Locator}}">
						<ListView.ItemTemplate>
							<DataTemplate>
								<Image Source="{Binding Path=BannerPath, Mode=OneWay}"
						   Width="260"
						   Stretch="Fill"/>
							</DataTemplate>
						</ListView.ItemTemplate>
						<ListView.ItemsPanel>
							<ItemsPanelTemplate>
								<WrapPanel IsItemsHost="True"
							   Width="{Binding (FrameworkElement.ActualWidth), RelativeSource={RelativeSource AncestorType=ScrollContentPresenter}}"/>
							</ItemsPanelTemplate>
						</ListView.ItemsPanel>
					</ListView>
				</Grid>
			</TabItem>
			<!--Series poster-->
			<TabItem Header="Series Poster">
				<ListView ItemsSource="{Binding Path=SeriesPoster}"
						  Margin="2"
						  VerticalAlignment="Stretch"
						  HorizontalAlignment="Stretch"
						  SelectedItem="{Binding Path=CurrentBanner, Mode=TwoWay}">
					<ListView.ItemTemplate>
						<DataTemplate>
							<Image Source="{Binding Path=BannerPath, Mode=OneWay}"
								   Width="300"
								   Stretch="Uniform"/>
						</DataTemplate>
					</ListView.ItemTemplate>
					<ListView.ItemsPanel>
						<ItemsPanelTemplate>
							<WrapPanel IsItemsHost="True"
							   Width="{Binding (FrameworkElement.ActualWidth), RelativeSource={RelativeSource AncestorType=ScrollContentPresenter}}"/>
						</ItemsPanelTemplate>
					</ListView.ItemsPanel>
				</ListView>
			</TabItem>
		</TabControl>
		
		<Button Content="Store graphic"
				Grid.Row="2"
				VerticalAlignment="Center"
				HorizontalAlignment="Center"
				Command="{Binding Path=StoreImageCommand}"/>
    </Grid>
</UserControl>
